<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>地理位置聚合 | Elasticsearch: 权威指南 | Elastic</title>
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
</head>
<body>
<div class="main-container">
    <section id="content">
        
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原文地址: <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-aggs.html" rel="nofollow">https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-aggs.html</a>, 版权归 www.elastic.co 所有<br/>
                            英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/geo-aggs.html" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/guide/current/geo-aggs.html</a>
                            </div>
                        <!-- start body -->
                  <div class="page_header">
<b>请注意:</b><br>本书基于 Elasticsearch 2.x 版本，有些内容可能已经过时。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch: 权威指南</a></span>
»
<span class="breadcrumb-link"><a href="geoloc.html">地理位置</a></span>
»
<span class="breadcrumb-node">地理位置聚合</span>
</div>
<div class="navheader">
<span class="prev">
<a href="geohash-cell-query.html">« Geohash 单元查询</a>
</span>
<span class="next">
<a href="geo-distance-agg.html">地理距离聚合 »</a>
</span>
</div>
<div class="chapter">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="geo-aggs"></a>地理位置聚合<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elasticsearch-cn/elasticsearch-definitive-guide/edit/cn/330_Geo_aggs/60_Geo_aggs.asciidoc">edit</a>
</h2>
</div></div></div>
<p>虽然按照地理位置对结果进行过滤或者打分很有用， 但是在地图上呈现信息给用户通常更加有用。一个查询可能会返回太多结果以至于不能单独地展现每一个地理坐标点，但是地理位置聚合可以用来将地理坐标聚集到更加容易管理的 buckets 中。</p>
<p>处理 <code class="literal">geo_point</code> 类型字段的三种聚合：</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<a class="xref" href="geo-distance-agg.html" title="地理距离聚合"><code class="literal">地理位置距离 (geo_distance)</code></a>
</span>
</dt>
<dd>
将文档按照距离围绕一个中心点来分组。
</dd>
<dt>
<span class="term">
<a class="xref" href="geohash-grid-agg.html" title="Geohash 网格聚合"><code class="literal">geohash网格 (geohash_grid)</code></a>
</span>
</dt>
<dd>
将文档按照 geohash 范围来分组，用来显示在地图上。
</dd>
<dt>
<span class="term">
<a class="xref" href="geo-bounds-agg.html" title="地理边界聚合"><code class="literal">地理位置边界 (geo_bounds)</code></a>
</span>
</dt>
<dd>
返回一个包含所有地理位置坐标点的边界的经纬度坐标<code class="literal">lat/lon</code>，这对显示地图时缩放比例的选择非常有用。
</dd>
</dl>
</div>



</div>
<div class="navfooter">
<span class="prev">
<a href="geohash-cell-query.html">« Geohash 单元查询</a>
</span>
<span class="next">
<a href="geo-distance-agg.html">地理距离聚合 »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>